package com.wxapp.custom.service.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wxapp.common.constant.base.IBaseController;
import com.wxapp.common.constant.pojo.vm.ResultVm;
import com.wxapp.custom.api.pojo.vm.customAccount.PCustomAccountDetailVm;
import com.wxapp.custom.api.pojo.vm.customAccount.PCustomAccountPageVm;
import com.wxapp.custom.api.pojo.vo.customAccount.QCustomAccountPageVo;
import com.wxapp.custom.api.pojo.vo.customAccount.QCustomAccountVo;
import com.wxapp.custom.service.service.AccountService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * @author lgl
 */
@RequestMapping("account")
@Tag(name = "用户账户")
@RestController
@RequiredArgsConstructor
public class AccountController extends IBaseController {
    private final AccountService userAccountService;

    @GetMapping("getDetail/{id}")
    @Operation(summary = "获取账户信息")
    public ResultVm<PCustomAccountDetailVm> getUserAccount(@PathVariable String id) {
        return userAccountService.getUserAccount(id);
    }

    @PostMapping("page")
    @Operation(summary = "获取账户列表")
    public ResultVm<Page<PCustomAccountPageVm>> page(@RequestBody QCustomAccountPageVo qCustomAccountPageVo) {
        return userAccountService.page(qCustomAccountPageVo);
    }

    @PostMapping("pay")
    @Operation(summary = "用户账户支付")
    public ResultVm<String> pay(@RequestBody QCustomAccountVo vo) {
        return userAccountService.pay(vo);
    }
}
